package base.day25;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class DemoCallable {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        //线程开启之后需要执行里面的call方法
        MyCallable mc=new MyCallable();
        //可获取线程执行完毕的结果，也可作为参数传递给Thread对象
        FutureTask<String> ft=new FutureTask(mc);
        //创建线程对象
        Thread t1=new Thread(ft);
        t1.start();

        //得到线程执行完毕的结果
        String o = ft.get();
        System.out.println(o);
    }
}
